package cn.tedu.truetaste.controller;

import cn.tedu.truetaste.pojo.vo.SkuStandardVO;
import cn.tedu.truetaste.service.IDishesService;
import cn.tedu.truetaste.service.ISkuService;
import cn.tedu.truetaste.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("dishes/sku")
@Api(tags = "前台菜品SKU模块")
public class SkuController {
    @Autowired
    private IDishesService dishesService;

    @GetMapping("/{spuId}")
    @ApiOperation("根据spuId查询sku列表")
    @ApiImplicitParam(value = "spuId",name = "spuId",example = "1")
    public JsonResult<List<SkuStandardVO>> getSkuListBySpuId(@PathVariable Long spuId){
        List<SkuStandardVO> list=dishesService.getSkusBySpuId(spuId);
        return JsonResult.ok(list);
    }
}
